package services

import (
	"errors"
	"finance/internal/dto"
	"finance/internal/models"
)

func GetUserAccountInfo(userID uint) (*dto.AccountResponse, error) {
	account, err := models.GetAccountByUserID(userID)
	if err != nil {
		return nil, errors.New("account not found")
	}
	return &dto.AccountResponse{
		AccountNo: account.AccountNo,
		Balance:   account.Balance,
		Status:    account.Status,
	}, nil
}

func GetAllAccounts() ([]models.Account, error) {
	return models.GetAllAccounts()
}

func DisableAccount(accountID uint) error {
	return models.UpdateAccountStatus(accountID, "disabled")
}
